home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / utility / ffe101.zip / ANIM.SWG / 0001_ANM EXPLANATION.pas next >
Pascal/Delphi Source File  |  1996-09-03  |  6KB  |  151 lines

  1. --------a-ANM-------------------------------
  2.  
  3. DeluxePaint  Animation  ".ANM"  files consist of  a  large  header and a
  4. series  of structures that can be up  to 64 KB long each. The programmer
  5. refers  to  these structures as "Large  Pages". Large Pages are a format
  6. for dividing a file into 64 KB chunks that can be stored out-of-sequence
  7. in  the  file. That is, a large  page can be logically inserted into the
  8. file, without having to move all the following data out of the way.
  9.  
  10. Each  large  page holds one or  more  "records". A record represents one
  11. frame  of  the original animation. A record  is  of any length from 0 to
  12. almost  64 KB. The records in a  large page are sequential. However, the
  13. first large page may not contain the first frames of the anim file. Each
  14. large  page  contains  a sequential set  of  records but the large pages
  15. themselves  are  not in sequential order.  It  is possible for the first
  16. large  page  in a file to contain  the last few frames of the animation.
  17. When  you process the anim file you  must scan the large page structures
  18. to  find  which  large page conatins the  frame  you  wish to display or
  19. process next.
  20.  
  21. A  DeluxePaint Animation "ANM" ("Anim") file is built on this mechanism,
  22. so  that as frames change in size, they can be maintained with a minimum
  23. of  extra  file  i/o,  yet  without  loss  of  playback  performance. In
  24. addition,  there  is an optional special  record which is the delta from
  25. the last frame to the first frame, for smooth playback of looping anims.
  26.  
  27. The  following  is  the structure of  a  DeluxeAnimate anim file header.
  28. Header size is exactly 2816 bytes. The first large page structure can be
  29. reached by simply seeking to this location in the file.
  30.  
  31.  ULONG id;            4 character ID == "LPF "
  32.  
  33.  UWORD maxLps;        max # largePages allowed. 256 FOR NOW.
  34.  
  35.  UWORD nLps;          # largePages in this file.
  36.  
  37.  ULONG  nRecords; #   records in this file. 65534 is current limit plus
  38.                       one for last-to-first delta for looping the animation
  39.  
  40.  UWORD maxRecsPerLp;    # records permitted in an lp. 256 FOR NOW.
  41.  
  42.  UWORD lpfTableOffset;
  43.        Absolute  Seek  position of lpfTable. 1280 FOR  NOW. The lpf Table is an
  44. array  of  256 large page structures  that is used to facilitate finding
  45. records  in an anim file without having to seek through all of the Large
  46. Pages to find which one a specific record lives in.
  47.  
  48.  ULONG contentType;    4 character ID == "ANIM"
  49.  
  50.  UWORD width;        Width of screen in pixels.
  51.  UWORD height;        Height of screen in pixels.
  52.  UBYTE variant;        0==ANIM.
  53.  UBYTE version;        0==frame rate is multiple of 18 cycles/sec.
  54.                        1==frame rate is multiple of 70 cycles/sec.
  55.  
  56.  UBYTE hasLastDelta;   1==Last record is a delta from last-to-first frame.
  57.  
  58.  UBYTE lastDeltaValid;
  59.             0==The last-to-first delta (if present) hasn't been
  60.             updated to match the current first&last frames,    so it
  61.             should be ignored.
  62.  
  63.  UBYTE pixelType;    0==256 color.
  64.  
  65.  UBYTE CompressionType;    1==(RunSkipDump) Only one used FOR NOW.
  66.  
  67.  UBYTE otherRecsPerFrm;    0 FOR NOW.
  68.  
  69.  UBYTE bitmaptype;    1==320x200, 256-color.  Only one implemented so far.
  70.  
  71.  UBYTE recordTypes[32];    Not yet implemented.
  72.  
  73.  ULONG nFrames;        In case future version adds other records at end of
  74.             file, we still know how many actual frames.
  75.             NOTE: DOES include last-to-first delta when present.
  76.  
  77.  UWORD framesPerSecond;    Number of frames to play per second.
  78.  
  79.  UWORD pad2[29];    58 bytes of filler to round up to 128 bytes total.
  80.  
  81.  Range cycles[16];    Color cycling info (128 bytes long).
  82.             This is the format of a cycle structure.
  83.             typedef struct {
  84.                     WORD count;
  85.                     WORD rate;
  86.                     WORD flags;
  87.                     UBYTE low, high; /* bounds of range */
  88.                     } Range;
  89.  
  90.  
  91.     total is = 256 bytes.
  92.  
  93.  Following the anim file header is the color palette
  94.  
  95.  ULONG    palette[256]
  96.  Color palette arranged as 3 bytes each of Red Green& Blue and one unused
  97.  byte.
  98.  
  99. Following  the palette is an array of  structures that are copies of the
  100. large  page  headers. This array is loaded  and used to find which large
  101. page a given frame can be found in.
  102.  
  103.  Large_page  LParay[256] Copies of all the  Large Page structures in the
  104. anim file. Each Large Page structure is 6 bytes long so the total length
  105. of this table is 1536 bytes. Even if the file only contains 1 large page
  106. there are still 256 entries of 6 bytes each.
  107.  
  108. The  Large Pages follow the LParray and  are in the sequence dictated by
  109. their order of occurence in the LParray in the anim file header.
  110.  
  111. The  following is the structure of a  single Large Page in an anim file.
  112. Each Large Page is exactly 64k long in the anim file. The only exception
  113. is  the  last  large  page  wich is  truncated  to  be  only  as long as
  114. necessary.
  115.  
  116.  UWORD baseRecord;  Number of first record in this large page.
  117.  
  118.  UWORD nRecords;    Number of records in lp.
  119.             bit 15 of "nRecords" == "has continuation from previous lp".
  120.             bit 14 of "nRecords" == "final record continues on next lp".
  121.  
  122.  UWORD nBytes;      Total number of bytes of contents, excluding header.
  123.  
  124.  UWORD BytesContinued;
  125.             The number of bytes of the last record of the
  126.             previous large page that extend into this large page.
  127.             This was never implemented and is always 0.
  128.  
  129.  UWORD RecordSizes[nRecords] Array of lengths of each record in the large
  130.                              page.
  131.  
  132. The  actual records start here. Each record has a variable length header
  133. that is like the following structure.
  134.  
  135.     typedef struct{
  136.         UBYTE IDnum;        always 66
  137.         UBYTE Flags;        0==no extra bytes field next
  138.  
  139.         UWORD extrabytes;    if Flags is non zero this is # of bytes
  140.                     to skip before compressed data starts
  141.                     extrabytes does not include the size
  142.                     of the 2 previous bytes.  Also make
  143.                     sure you round the final address up to
  144.                     an even byte boundry.
  145.         } record_header;
  146.  
  147. EXTENSION:ANM
  148. OCCURENCES:PC,AMIGA (?)
  149. PROGRAMS:Deluxe Paint
  150. SEE ALSO:LBM,RIFF,FLI
  151.